package com.linuxgt.web.controller;

import com.linuxgt.web.constant.Const;
import com.linuxgt.web.util.PropertiesUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
/**
 * 测试控制器
 * Created by liuteng on 2016/11/24.
 */
@Controller("com.linuxgt.web.controller.TestController")
@RequestMapping(value = "/test/*")
public class TestController extends BaseController{

    private final Logger log = LoggerFactory.getLogger(TestController.class);

    @Autowired
    private PropertiesUtils propertiesUtils;

    @RequestMapping(value = "/home",method = RequestMethod.GET)
    public String test(){
        log.debug("Controller Name:{}",getClass().getName());
        return "home";
    }

    @RequestMapping(value = "/demo",method = RequestMethod.GET)
    public String demo(){
        log.debug("Controller Name:{}",getClass().getName());
        return "demo";
    }

    @RequestMapping(value = "/pattern",method = RequestMethod.GET)
    public String pattern(Model model){
        String pattern = propertiesUtils.getMessage(Const.PATTERN);
        log.debug("Pattern:{}",pattern);
        model.addAttribute("pattern", pattern);
        return "home";
    }

    @RequestMapping(value = "/add",method = RequestMethod.GET)
    public String add(Model model){
        log.debug("math.");
        return "math";
    }

}
